#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e5+1000;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL ksm(LL a,LL k){
   LL res=1;
   while(k>0){
      if(k&1) res=res*a;
      k>>=1;
      a=a*a;
   }
   return res;
}
int main(void){
   ///cin.tie(0);std::ios::sync_with_stdio(false);
   LL t;cin>>t;
   for(LL i=1;i<=10;i++){

   }
   while(t--){
      LL a,b,c;cin>>a>>b>>c;
//      LL down=ksm(10,c-1);
//      LL up=ksm(10,c);
//      LL downa=ksm(10,a-1);
//      LL upa=ksm(10,a);
//      LL downb=ksm(10,b-1);
//      LL upb=ksm(10,b);
//      for(LL i=down;i<=up;i++){
//          for(LL j=1; ;j++){
//
//          }
//      }
      if(c==1){
//         LL num1=ksm(10,a-1)+1;
//         LL num2=ksm(10,b-1);
//         cout<<__gcd(11,111)<<"\n";
         LL num1=1;LL num2=1;
         for(LL i=1;i<a;i++) num1=num1*10+1;
         for(LL i=1;i<b;i++) num2=num2*10+1;
         if(num1==num2) num2++;
         cout<<__gcd(num1,num2)<<"\n";
         cout<<num1<<" "<<num2<<"\n";
      }
      else{
         LL gcd=ksm(10,c-1);
         LL num1=0;
         for(LL i=1; ;i++){
            if(i*gcd>=ksm(10,a-1)&&i*gcd<ksm(10,a)){
                num1=i*gcd;break;
            }
         }
         LL num2=0;
         for(LL i=1; ;i++){
            if(i*gcd>=ksm(10,a-1)&&i*gcd<ksm(10,a)&&i*gcd!=num1){
                num2=i*gcd;break;
            }
         }
         cout<<__gcd(num1,num2)<<"\n";
         cout<<num1<<" "<<num2<<"\n";
      }
   }
   return 0;
}
